package homework;

import javax.jws.Oneway;

public class HomeWork4 {
    public static double Avi(int []arr) {
        double sum=0;
        for (int x:arr) {
            sum+=x;
        }
        return sum/arr.length;
    }
    public static int sum(int []arr) {
        int sum = 0;
        for (int x : arr) {
            sum += x;
        }
        return sum;
    }
    public static int[]  transform(int []arr){
        int[]num=new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            num[i]=arr[i]*2;
        }
        return num;
    }
    public static void printArray(int[] arr){
        for (int i:arr) {
            System.out.print(i+" ");
        }
    }
    public static int[] Copy(int []arr){
        int []arr1= new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            arr1[i]=arr[i];
        }
        return arr1;
    }
    public static String ToString(int []arr){
        String str="";
        str+="[";
        for (int i = 0; i < arr.length; i++) {
            str+=i;
            if(i!=arr.length-1){
                str+=",";
            }
        }
        str+="]";
        return str;
    }
    public static void main(String[] args) {
       int []arr={1,2,3,4,4,5};
        System.out.println(ToString(arr));
    }
}
